package com.youyi.yyviewsdklibrary.View;

import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.util.AttributeSet;
import android.util.Log;
import android.view.View;
import android.widget.TextView;

public class MyBeiTextView extends TextView {
    private static final String TAG = "MyBeiTextView";
    Context mContext;

    public MyBeiTextView(Context context) {
        super(context);
    }

    public MyBeiTextView(Context context, AttributeSet attributeSet) {
        super(context, attributeSet);
        this.mContext = context;
        setOnClickListener(new OnClickListener() {
            /* class com.youyi.yyviewsdklibrary.View.MyBeiTextView.AnonymousClass1 */

            public void onClick(View view) {
                Log.d(MyBeiTextView.TAG, "MyBeiTextView========");
                MyBeiTextView myBeiTextView = MyBeiTextView.this;
                myBeiTextView.openWeb(myBeiTextView.mContext, "https://beian.miit.gov.cn");
            }
        });
    }

    public void openWeb(Context context, String str) {
        try {
            Intent intent = new Intent("android.intent.action.VIEW");
            intent.addFlags(335544320);
            intent.setData(Uri.parse(str));
            context.startActivity(intent);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
